/**
 * 2013 2013-5-7
 */
package com.surfilter.dp.context;

import com.surfilter.dp.dao.ActionDao;
import com.surfilter.dp.dao.ModuleDao;
import com.surfilter.dp.view.ActionPanel;
import com.surfilter.dp.view.MainWindow;
import com.surfilter.dp.view.ModuleDetailPanel;
import com.surfilter.dp.view.ModuleTree;

/**
 * 
 */
public class ContextHolder {

	private static ContextHolder instance;
	
	private ModuleDao moduleDao;
	
	private ActionDao actionDao;
	
	private ModuleDetailPanel modulePanel;
	
	private ModuleTree moduleTree;
	
	private MainWindow mainWin;
	
	private ActionPanel actionPanel;
	
	public static boolean isGenJavaSuccess = true;
	
	public static boolean isGenJSSuccess = true;

	static {
		instance = new ContextHolder();
	}
	private ContextHolder() {
	}  

	public static ContextHolder getInstance() {
		return instance;
	}
	
	public void init(){
		this.moduleDao = new ModuleDao();
		this.actionDao = new ActionDao();
	}
	
	public void destroy(){
		this.moduleDao.destroy();
		this.actionDao.destroy();
	}

	/**
	 * @return the moduleDao
	 */
	public ModuleDao getModuleDao() {
		return moduleDao;
	}

	/**
	 * @param moduleDao the moduleDao to set
	 */
	public void setModuleDao(ModuleDao moduleDao) {
		this.moduleDao = moduleDao;
	}

	/**
	 * @return the actionDao
	 */
	public ActionDao getActionDao() {
		return actionDao;
	}

	/**
	 * @param actionDao the actionDao to set
	 */
	public void setActionDao(ActionDao actionDao) {
		this.actionDao = actionDao;
	}

	/**
	 * @return the modulePanel
	 */
	public ModuleDetailPanel getModulePanel() {
		return modulePanel;
	}

	/**
	 * @param modulePanel the modulePanel to set
	 */
	public void setModulePanel(ModuleDetailPanel modulePanel) {
		this.modulePanel = modulePanel;
	}

	/**
	 * @return the moduleTree
	 */
	public ModuleTree getModuleTree() {
		return moduleTree;
	}

	/**
	 * @param moduleTree the moduleTree to set
	 */
	public void setModuleTree(ModuleTree moduleTree) {
		this.moduleTree = moduleTree;
	}

	/**
	 * @return the mainWin
	 */
	public MainWindow getMainWin() {
		return mainWin;
	}

	/**
	 * @param mainWin the mainWin to set
	 */
	public void setMainWin(MainWindow mainWin) {
		this.mainWin = mainWin;
	}

	/**
	 * @return the actionPanel
	 */
	public ActionPanel getActionPanel() {
		return actionPanel;
	}

	/**
	 * @param actionPanel the actionPanel to set
	 */
	public void setActionPanel(ActionPanel actionPanel) {
		this.actionPanel = actionPanel;
	}
	
	
	
}
